<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('school/index')}">学校列表</a></li>
			<li class="active"><a href="{:url('school/add')}">添加学校</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('school/addpost')}">
			<div class="form-group">
				<label for="school_name" class="col-sm-2 control-label"><span class="form-required">*</span>学校名称</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="school_name" name="school_name">
				</div>
			</div>

			<div class="form-group">
				<label for="school_name" class="col-sm-2 control-label"><span class="form-required">*</span>省份</label>
				<div class="col-md-6 col-sm-10">
					<select name='province' class="form-control" id="selectProvince">
						<option value="">请选择省份</option>
						<foreach name="province" item="vo">
							<option value="{$vo.areaId}">{$vo.areaName}</option>
						</foreach>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="school_name" class="col-sm-2 control-label"><span class="form-required">*</span>市</label>
				<div class="col-md-6 col-sm-10">
					<select name='city' class="form-control" id="selectCity">
						<option value="">请选择市</option>

					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="school_name" class="col-sm-2 control-label"><span class="form-required">*</span>区县</label>
				<div class="col-md-6 col-sm-10">
					<select name='district' class="form-control" id="selectDistrict">
						<option value="">请选择区县</option>

					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="street" class="col-sm-2 control-label"><span class="form-required">*</span>详细地址</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="street" name="street">
				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script>
		$(function () {

			$('#selectProvince').change('click',function () {

				var areaId=$('#selectProvince').val();

				$.ajax({
					url:"{:url('school/getProvince')}",
					type:"POST",
					data:{areaId:areaId},
					success:function (res) {
						console.log(res);
						$('#selectCity').html(res);
					}
				});
			});
		})
	</script>
	<script>
		$(function () {

			$('#selectCity').change('click',function () {

				var areaId=$('#selectCity').val();

				$.ajax({
					url:"{:url('school/getCity')}",
					type:"POST",
					data:{areaId:areaId},
					success:function (res) {
						console.log(res);
						$('#selectDistrict').html(res);
					}
				});
			});
		})
	</script>
</body>
</html>